package org.dromara.hm.enums;

/**
 * 回款调整类型枚举
 *
 * @Author Claude Code
 * @Date 2025-01-16
 * @Version 1.0
 */
public enum PaymentAdjustmentTypeEnum {
    DEBT_RELIEF("DEBT_RELIEF", "债务减免"),
    ERROR_CORRECTION("ERROR_CORRECTION", "错误修正"),
    BAD_DEBT("BAD_DEBT", "坏账核销"),
    AGING_ADJUSTMENT("AGING_ADJUSTMENT", "账龄调整"),
    DEBT_RESTRUCTURE("DEBT_RESTRUCTURE", "债务重组"),
    OTHER("OTHER", "其他"),
    ;

    private final String code;
    private final String description;

    PaymentAdjustmentTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据代码获取枚举
     *
     * @param code 代码
     * @return 枚举值
     */
    public static PaymentAdjustmentTypeEnum getByCode(String code) {
        for (PaymentAdjustmentTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return OTHER;
    }
}
